{template 'common/header'}
<ul class="nav nav-tabs">
    <li><a href="{php echo $this->createWebUrl('entry');}">活动参与方式</a></li>
    <li><a href="{php echo $this->createWebUrl('activity');}">红包活动管理</a></li>
    <li class="active"><a href="{php echo $this->createWebUrl('activity', array('foo'=>'records', 'id'=>$activity['actid']));}">查看发放记录</a></li>
    <li><a href="{php echo $this->createWebUrl('gifts');}">礼品设置</a></li>
    <li><a href="{php echo $this->createWebUrl('api');}">接口参数</a></li>
</ul>
<div class="clearfix">
    <div class="panel panel-info">
        <div class="panel-heading">筛选</div>
        <div class="panel-body">
            <form action="" method="get" class="form-horizontal" role="form">
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="m" value="microb_redpack_lottery" />
                <input type="hidden" name="do" value="activity" />
                <input type="hidden" name="id" value="{$activity['actid']}" />
                <input type="hidden" name="foo" value="records" />
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 control-label">昵称</label>
                    <div class="col-sm-8 col-md-8 col-lg-8 col-xs-12">
                        <input class="form-control" name="nickname" type="text" value="{$_GPC['nickname']}">
                    </div>
                </div>
                <div class="form-group hide">
                    <label class="col-xs-12 col-sm-2 col-md-2 control-label">状态</label>
                    <div class="col-sm-8 col-md-8 col-lg-8 col-xs-12">
                        <label class="radio-inline">
                            <input type="radio" name="status" value="" {if empty($_GPC['status'])}checked="checked"{/if}> 不限
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="status" value="success" {if $_GPC['status']=='success'}checked="checked"{/if}> 发放成功
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="status" value="failed" {if $_GPC['status']=='failed'}checked="checked"{/if}> 未成功
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 control-label"></label>
                    <div class="col-sm-8 col-md-8 col-lg-8 col-xs-12">
                        <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading">
            红包领取记录
        </div>
        <div class="table-responsive panel-body">
            <table class="table table-hover">
                <tr>
                    <th style="width:90px;"></th>
                    <th style="width:120px;">昵称</th>
                    <th>城市</th>
                    <th style="width:200px;">个人资料</th>
                    <th style="width:100px;">领取奖品</th>
                    <th style="width:100px;">奖品详情</th>
                    <th style="width:160px;">领取时间</th>
                    <th style="width:100px;">发放状态</th>
                </tr>
                {loop $ds $row}
                <tr>
                    <td><img src="{$row['avatar']}" alt="" width="64" class="img-rounded" /></td>
                    <td>{$row['nickname']}</td>
                    <td>{$row['state']}/{$row['city']}</td>
                    <td style="line-height:1.5em;">
                        {if !empty($row['profile']['name'])}
                        <span class="label label-info">{$row['profile']['name']['title']}: {$row['profile']['name']['value']}</span> <br>
                        {/if}
                        {if !empty($row['profile']['phone'])}
                            <span class="label label-info">{$row['profile']['phone']['title']}: {$row['profile']['phone']['value']}</span>
                        {/if}
                    </td>
                    <td>
                        {if $row['status'] != 'none'}
                            {$row['gift']['title']}
                        {/if}
                    </td>
                    <td>
                        {if $row['status'] != 'none' && $row['gift']['type'] == 'cash'}
                        <span class="label label-success">金额: {$row['fee']}</span>
                        {/if}
                    </td>
                    <td style="line-height:1.5em;">
                        <span class="label label-info" title="领取时间">{php echo date('Y-m-d H:i', $row['created']);}</span> <br>
                        {if $row['status'] == 'complete' && $row['gift']['type'] == 'cash'}
                        <span class="label label-success" title="发放时间">{php echo date('Y-m-d H:i', $row['completed']);}</span> <br>
                        {/if}
                    </td>
                    <td style="line-height:1.5em;">
                        {if $row['status'] == 'none'}
                        <span class="label label-default">未中奖</span>
                        {/if}
                        {if $row['status'] == 'complete'}
                        <span class="label label-success">成功领取</span>
                        {/if}
                        {if $row['status'] == 'created'}
                        <span class="label label-warning">未领奖</span>
                            {if !empty($row['log']) && !preg_match('/^\d+$/', $row['log'])}
                            <br> <abbr title="{$row['log']}" onclick="alert('{$row['log']}')"><span class="label label-danger">查看详情</span></abbr>
                            {/if}
                        {/if}
                    </td>
                </tr>
                {/loop}
            </table>
        </div>
        <div class="panel-body text-right">
            {$pager}
        </div>
    </div>
</div>
{template 'common/footer'}
